﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class User_controls_QuickReply : UserControl,ICallbackEventHandler
{
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!Page.IsPostBack) {
			hfCaptcha.Value = Guid.NewGuid().ToString();
		}
		Page.ClientScript.GetCallbackEventReference(this, "arg", null, string.Empty);
	}

	#region ICallbackEventHandler Members
	private string _Callback;
	public string GetCallbackResult()
	{
		return _Callback;
	}

	public void RaiseCallbackEvent(string eventArgument)
	{
		var sentCaptcha = eventArgument;
		var storedCaptcha = hfCaptcha.Value;
		if (sentCaptcha != storedCaptcha)
		{
			_Callback = "1";
		}
		else {
			_Callback = "-1";
		}
	}

	#endregion
}
